#!/usr/bin/runhugs
-- created on 2009-01-23

tr s1 s2 = map fn  where
 fn = \ch -> maybe ch id $ lookup (fromEnum ch) table
 table = [ (fromEnum x,y) | (x,y) <- zip s1 s2]

toUpper = tr ['a'..'z'] ['A'..'Z']

complement = tr "ACBDKRTGVHMYU" "TGVHMYACBDKRA"

complement2 = symtr "ACBDKR" "TGVHMY" "U" "A"  where
 symtr s1 s2 a1 a2 = tr (s1++s2++a1) (s2++s1++a2)

main = putStrLn$ (reverse . complement2 . toUpper) s  where
 s = "cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg"
